package com.training1.core.modules.service;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.training1.api.exception.ApiAuthenticationException;
import com.training1.api.login.APILoginUtil;
import com.training1.core.common.entity.UserEntity;
import com.training1.core.common.global.Global;
import com.training1.core.common.service.CrudService;
import com.training1.core.common.utils.DateUtils;
import com.training1.core.common.utils.IdGen;
import com.training1.core.common.utils.StringUtils;
import com.training1.core.common.utils.excel.ExcelUtil;
import com.training1.core.entity.MemberEntity;
import com.training1.core.modules.dao.MemberDao;
import com.training1.core.modules.dao.DelegatedAuthorityDao;
import com.training1.core.modules.dao.SystemSettingsDao;
import com.training1.core.modules.dao.UserDao;

@Service
@Transactional
public class DelegatedAuthorityService extends CrudService<MemberDao,MemberEntity>{
	
	
	@Resource
	private DelegatedAuthorityDao nadao;
	
	/**
	 * 根据手机号获得会员基本信息
	 * @param param
	 * @return
	 */
	public MemberEntity findMemberInfo(String cellphone){
		return nadao.findMemberInfoByCell(cellphone);
	}
	/**
	 * 判断是否第一次购买
	 * @param param
	 * @return
	 */
	public String isFirstBuy(String cellphone){
		return nadao.isFirstBuy(cellphone);
	}
	/**
	 * 判断是否是代理商
	 * @param param
	 * @return
	 */
	public MemberEntity isAgents(String cellphone){
		return nadao.isAgents(cellphone);
	}
	/**
	 * 插入一条点位订单
	 * @param param
	 * @return
	 */
	public int insertTONodeOrder(Map<String,Object> map){
		return nadao.insertTONodeOrder(map);
	}
	/**
	 * 判断购买节点类型
	 * @param param
	 * @return
	 */
	public List<Integer> getStatus(String cellphone){
		return nadao.getStatus(cellphone);
	}
	
	/**
	 * 插入一条点位申请
	 * @param param
	 * @return
	 */
	public int insertTONodeApply(Map<String,Object> map){
		return nadao.insertTONodeApply(map);
	}
	/**
	 * 获得推荐点位数
	 * @param param
	 * @return
	 */
	public int getRecommendCount(String cellphone){
		return nadao.getRecommendCount(cellphone);
	}
	/**
	 * 判断是否是第一次购买
	 * @param param
	 * @return
	 */
	public String isExist(String cellphone){
		return nadao.isExist(cellphone);
	}
}
